home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 22
/
Cream of the Crop 22.iso
/
program
/
task3210.zip
/
README.TXT
< prev
next >
Wrap
Text File
|
1996-10-26
|
6KB
|
134 lines
Tasker32 Version 1.00 Documentation.
WHAT IS Tasker32?
=================
Tasker32 is a small library that "Threads", or tasks, your 32 bit protected
mode DPMI programs so that many portions of the code can run
simultaneously. A thread is simply a piece of code that is given processor
time on a regular basis, so the "task" runs x many times per second, or Hz.
WHY USE Tasker32?
=================
Quite simply to speed up program coding and simplify program code. It makes
the code easier to understand, as all the main code does very little. The
Tasker32 kernel runs functions that you pass to it at a given frequency
so the main program thread has to do very litte.
Take the example of a bouncing screen. Using traditional methods of coding,
the main program thread (that has control when no other threads have been
called by the Tasker32 kernel) updates the position of the ball in its
memory then on the screen checking for a bounce. As you add more balls,
the code gets more complex and messy as the main thread has to update them
all.
The Tasker32 library overcomes this by the main thread simply assigning the
task of moving the ball to another thread. Then, whenever the ball is due
to be updated, the Tasker32 kernel simply calls it for you, regardless of
what the main thread is doing. To add more balls, simply add more threads.
Use the same piece of code for each thread if you want to.
An additional advantage is control of how often something happens. In the
tradional method of single thread programming, it requires complex delays
to acheive the same speed on all computers. The Tasker32 library overcomes
this by you simply having to specifiy a frequency that the thread is to
run.
HOW TO USE Tasker32
===================
Using Tasker32 is a very simple process. In your main program code, (the
main thread) simply initialize the tasker with the task_init_tasker()
function. Its syntax is in TASK32.H.
To add threads is just as easy. Simply use task_add() with paramaters
pointing to the function to run on a regular basis and the number of times
per second to run it at. Again, its syntax is in TASK32.H.
All other functions available to the user are in TASK32.H.
To link in the Tasker32 library, include the TASK32.OBJ file on the command
line of the linker or compiler. See "Compiling The Sample Program" for an
example. This single object contains all the necessary code for threading.
COMPILING THE SAMPLE PROGRAM
============================
If you have the registered version of Tasker32, use the command
BCC32 -WX TEST.C TASK32.OBJ
to compile the sample program. However, if you have the shareware version
you must use
BCC32 -WX -DSHAREWARE TEST.C TASK32.OBJ
to compile that sample program successfully.
THE SHAREWARE VERSION
=====================
The shareware version has various limitations over the registered version.
The main limitation is the inability to access the task records in the
Tasker32 kernel. These contain information on the frequency the task runs
at, the delay on the system timer, the time left until the task is run
again and the pointer to the function that is run. This is the task_struct
structure outlined in TASK32.H.
Also, the task stack is limited to only 128kB, compared the 384kB in the
registered version. The stack allows standard C and C++ functions to run
without having errors and probably program crashes. The larger the stack,
the more functions can be nested.
You are not allowed to distribute programs written with the shareware
version. See SHARWARE.TXT for details and registration.
THE REGISTERED VERSION
======================
The registered version has full read-only access to the task records. It
is made read only deliberatly to prevent the user program accidentaly
corrupting the area. If, however, it is vital that it is writeable it
can be defined this way by removing the "const" declaration from the
TASK32.H file.
A full 384kB stack is provided so you will not run out of room when
nesting functions.
Best of all, the programs written using Tasker32 can be distributed
royalty free. See REGISTRD.TXT for details and limitations if you have
the registered version.
The source code is provided should it need to be specialized.
LIMITIATIONS OF Tasker32
========================
This is not a "true" multi-tasker, or even a "true" task swapper. The
kernel expects the called thread to finish executing before the computer
can continue normal operation. The task is not set up and stays that way
inside of a possibly infinate loop, such as other more expensive program
threaders.
This library is will be incompatible with a wide number of DOS DPMI
extenders. It is, however, compatible with Microsoft(R) Windows(TM).
If you find an incompatible extender, please mail me with the name, the
company and the version and I will add it here in future releases.
Incompatible Extenders:
Quaterdeck QDPMI 1.03
DISCLAIMER
==========
There is no warranty or gurantee whatsoever provided with this program,
library and associated files. It is provided as-is. The author cannot and
will not be held liable in any way for any damaged or loss caused either
directly or indirectly by this program, library and associated files.
CONTACTING THE AUTHOR
=====================
To contact the author send email to either of
guyat@xtra.co.nz
guyat@voyager.co.nz
Please expect upto a week until reply.
To send snail-mail to the author, the address is
Guy Thornley
Katene Road
RD 15
Hawera
New Zealand
Do not forget air mail if required. All cheques, money, etc. can be sent
to this address.